package com.demo.oauth.server.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.demo.oauth.server.model.AuthenticationCode;

/**
 * CODE Dao
 * 
 * @author johnguo
 *
 */
@Mapper
public interface AuthenticationCodeMapper extends BaseMapper<AuthenticationCode> {

	@Insert("INSERT INTO authentication_code(code,user_id,client_id) values(#{code},#{userId},#{clientId})")
	int insert(AuthenticationCode code);

	@Update("UPDATE authentication_code SET valid=0 WHERE code=#{code}")
	int deleteById(String code);

}
